<div class="row">
	<div class="panel callout">
		<h6>Subject Attendance
			<?
				if(!empty($subject))
				{
					echo ': ' . $subject->subj_code . ' (' . $subject->subj_desc . ')';
				}
			?>
		</h6>
	</div>
		<?php echo validation_errors(); ?>
		<?if(isset($system_message)) echo $system_message;
			require('grades_nav.php');
		?>
		
		<?if(!empty($subject) && !empty($attendance)):?>
			<div class="panel"><h6><?=date('F d, Y', strtotime($date));?></h6></div>
			
			<form action="<?=site_url(array('teacher', 'view_edit_subject_attendance', $subject->subj_id, $date));?>" class="custom submit_forms" method="POST">
				<table>
					<thead>
						<tr>
							<th width="200">Student</th>
							<th width="200">Attendance</th>
							<th width="200">Reason</th>
							<th width="200">Remarks</th>
						</tr>
					</thead>
					<tbody>
						<?foreach($attendance as $att): ?>
						<?$id = $att->profile_id; ?>
						<?$id_arr[] = $id; ?>
							<tr>
								<td><?=strtoupper($att->lastname) . ', ' . ucfirst($att->firstname) . ' ' . ucfirst($att->middlename); ?>
									<p><?=$id?></p>
								<td>
									<select name="attendance[<?=$id?>][in_class]">
										<option value="1" <?if($att->in_class == 1) echo 'selected';?>>Present</option>
										<option value="0" <?if($att->in_class == 0) echo 'selected';?>>Absent</option>
										<option value="2" <?if($att->in_class == 2) echo 'selected';?>>Tardy</option>
										<option value="3" <?if($att->in_class == 3) echo 'selected';?>>Cut Class</option>
									</select>
								</td>
								<td><input type="text" name="attendance[<?=$id;?>][reason]" value="<?=$att->reason?>" /></td>
								<td><input type="text" name="attendance[<?=$id;?>][remarks]" value="<?=$att->remarks?>" /></td>
								<?=form_hidden('attendance[' . $id . '][room_id]', $att->room_id) ;?>
							</tr>
						<?endforeach;?>
					</tbody>
				</table>
				<?=form_hidden('section_id', $section_id->id); ?>
				<?=form_hidden('id_arr', $id_arr); ?>
				<a href="#" class="button small success submit_btns">Update Attendance</a>
			</form>
		<?endif;?>
		
</div>